<?

	require_once '_uniquedir.php';

	class Fmgr0v0r01_Trash extends Fmgr0v0r01__uniquedir{
		
		protected $rdk = 'desk';
		protected $mod = 775;
		var $media_class = 'Trash Can';
		
####	Adding and removing children
		
		function icon(){
			return (!$this->length()) ? 'Trash.png' : 'TrashFull.png';
		}
		
		function is_valid_child($o){
			// is_valid_child is sent jso objects when the file is new, i.e. we're discovering a child we didn't know we had
			// so we need to test if the funcs are callable
			if(is_callable(array($o, 'is_destroyable')) && $o->is_destroyable() && $o->destroy()) return false;
			return parent::is_valid_child($o);
		}

		function kill(Smuoi_Resource $child){
			if(!$this->is_writex()) return false;
			if(!$this->pkg->is_fmgr_rsrc($child)) return false;
			if(!$this->isMyChild($child)) return false;
			if(!$child->destroy()) return false;
			$this->removeChild($child, $child->basename());
			return true;
		}
		
		function purge(){
			if(!$this->is_writex()) return false;
			foreach($this->children() as $child) $this->kill($child);
		}
	}

?>